const user = {
	namespaced:true,
	state:{
		baseInfo:{
			isLogin:false,
			id: null,
			compaynName:null,
			companyId:null,
			username: null,
			telNo: null,
			operatorType: null,
		}
		
	},
	mutations:{
		//设置用户是否登录成功
		SET_USER_LOGIN_STATUS:(state,isLogin)=>{
			state.baseInfo.isLogin=isLogin
		},
		SET_LOGIN_BASE_INFO:(state,data)=>{
			const {userName='',id='',telNo='',compaynId='',companyName='',operatorType=''} = data 
			state.baseInfo.username=userName
			state.baseInfo.isLogin = true
			state.baseInfo.id = id
			state.baseInfo.telNo = telNo,
			state.baseInfo.companyId = compaynId
			state.baseInfo.companyName = companyName
			state.baseInfo.operatorType = operatorType
		}
	},
	actions :{ 
		SetLoginBaseInfo({commit},data){
			commit('SET_LOGIN_BASE_INFO', data)
		},
		SetUserLoginStatus({commit},isLogin){
			commit('SET_USER_LOGIN_STATUS', isLogin)
		}
	}
}

export default user